import 'package:dio/dio.dart';
import 'package:puppy_store/models/user_center_model.dart';
import 'package:puppy_store/service/requests.dart';

class UserCenterAPI {
  // 获取用户信息
  static Future<UserModel?> getUserInfo() async {
    String path = '/member/profile/check';
    Response response = await PuppyRequestManager().handleRequest(path, 'GET');
    Map res = response.data['result'];
    UserModel? userModel;
    // 如果没有登录, 则返回null
    if (res != null) {
      userModel = UserModel.fromjson(res);
    }

    return userModel;
  }
}
